--
-- Created by IntelliJ IDEA.
-- User: TJS
-- Date: 2023/7/15
-- Time: 22:08
-- To change this template use File | Settings | File Templates.
--
local key1 = KEYS[1]
local key2 = KEYS[2]

local value = redis.call('HGET', key1, key2)

if tonumber(value) then
    if tonumber(value) > 0 then
        redis.call('HSET', key1, key2, tonumber(value) - 1)
        return true
    else
        return tonumber(value) ~= 0
    end
else
    return false
end


